<template>
  <section class="QucikIconButton-container">
    <el-tooltip :content="tooltip" placement="bottom" effect="light">
      <div class="__panel">
        <i v-if="!disabled" class="icon" :class="clazz" @click="click" />
        <i v-else class="disabled" :class="clazz" />
      </div>
    </el-tooltip>
  </section>
</template>

<script>
export default {
  props: {
    icon: {
      required: true,
      type: String,
    },
    tooltip: String,
    disabled: {
      type: Boolean,
      default: false,
    },
  },

  computed: {
    clazz() {
      return `iconfont ${this.icon}`;
    },
  },

  methods: {
    click() {
      this.$emit("click");
    },
  },
};
</script>

<style lang="scss" scoped>
.QucikIconButton-container {
  border-radius: 50%;
  // height: 30px;
  // width: 30px;
  line-height: 30px;
  text-align: center;
  transition: 0.5s;
  box-sizing: border-box;
  margin: 0 5px;

  .icon {
    font-weight: 400;
    font-size: 1.6rem;
    color: #666;
    cursor: pointer;

    &:hover {
      color: #409eff;
      font-size: 1.7rem;
    }
  }

  .disabled {
    font-weight: 400;
    font-size: 1.6rem;
    color: #9999995f;
    cursor: no-drop;
  }
}
</style>